.messages-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #f5f5f5;
  padding-bottom: 40rpx;
}

.custom-nav {
  background: white;
  border-bottom: 1rpx solid #f0f0f0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-sizing: border-box;
  
  .nav-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 30rpx;
    height: 88rpx;
  }
  
  .nav-title {
    font-size: 36rpx;
    font-weight: bold;
    color: #333;
  }
  
  .nav-actions {
    .settings-icon {
      width: 48rpx;
      height: 48rpx;
      opacity: 0.6;
    }
  }
}

/* 登录提示 */
.login-prompt {
  height: calc(100vh - 120rpx);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60rpx;
  
  .login-card {
    background: white;
    border-radius: 20rpx;
    padding: 80rpx 60rpx;
    text-align: center;
    box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500rpx;
    
    .login-icon {
      width: 120rpx;
      height: 120rpx;
      margin-bottom: 40rpx;
      opacity: 0.6;
    }
    
    .login-title {
      display: block;
      font-size: 36rpx;
      font-weight: bold;
      color: #333;
      margin-bottom: 20rpx;
    }
    
    .login-desc {
      display: block;
      font-size: 28rpx;
      color: #999;
      margin-bottom: 60rpx;
    }
    
    .login-btn {
      background: #5cb85c;
      color: white;
      border-radius: 50rpx;
      font-size: 32rpx;
      padding: 24rpx 80rpx;
      border: none;
      
      &::after {
        border: none;
      }
    }
  }
}

.main-content {
  flex: 1;
  padding: 20rpx;
}

/* 服务评分卡片 */
.service-rating-card {
  background: linear-gradient(135deg, #5cb85c 0%, #7cc87c 100%);
  border-radius: 16rpx;
  padding: 30rpx;
  margin-bottom: 20rpx;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  
  .rating-info {
    flex: 1;
    
    .rating-title {
      display: block;
      font-size: 28rpx;
      opacity: 0.9;
      margin-bottom: 15rpx;
    }
    
    .rating-display {
      display: flex;
      align-items: baseline;
      
      .rating-score {
        font-size: 72rpx;
        font-weight: bold;
        margin-right: 10rpx;
      }
      
      .rating-unit {
        font-size: 32rpx;
        margin-right: 15rpx;
      }
    }
  }
  
  .unread-summary {
    text-align: center;
    
    .unread-text {
      display: block;
      font-size: 24rpx;
      opacity: 0.8;
      margin-bottom: 8rpx;
    }
    
    .unread-number {
      font-size: 48rpx;
      font-weight: bold;
    }
  }
}

/* 消息分类统计 */
.message-stats {
  display: flex;
  background: white;
  border-radius: 16rpx;
  padding: 25rpx 15rpx;
  margin-bottom: 20rpx;
  box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
  
  .stat-item {
    flex: 1;
    text-align: center;
    padding: 0 15rpx;
    
    .stat-number {
      display: block;
      font-size: 40rpx;
      font-weight: bold;
      color: #5cb85c;
      margin-bottom: 8rpx;
    }
    
    .stat-label {
      font-size: 24rpx;
      color: #999;
    }
  }
}

/* 消息列表 */
.message-list {
  height: calc(100vh - 400rpx);
}

.message-item {
  background: white;
  display: flex;
  align-items: center;
  padding: 30rpx;
  margin-bottom: 20rpx;
  border-radius: 20rpx;
  box-shadow: 0 2rpx 16rpx rgba(0, 0, 0, 0.06);
  position: relative;
  transition: all 0.3s ease;
  
  &:active {
    transform: scale(0.98);
    box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
  }
  
  &.unread {
    background: linear-gradient(135deg, #ffffff 0%, #f0f8f0 100%);
    border: 2rpx solid #5cb85c;
  }
  
  .message-avatar {
    position: relative;
    margin-right: 25rpx;
    
    .avatar {
      width: 100rpx;
      height: 100rpx;
      border-radius: 50%;
      background: #f0f0f0;
    }
    
    .unread-dot {
      position: absolute;
      top: 0;
      right: 0;
      width: 20rpx;
      height: 20rpx;
      background: #ff4757;
      border-radius: 50%;
      border: 3rpx solid white;
    }
    
    .message-type-icon {
      position: absolute;
      bottom: -5rpx;
      right: -5rpx;
      width: 36rpx;
      height: 36rpx;
      background: white;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
      
      image {
        width: 24rpx;
        height: 24rpx;
      }
    }
  }
  
  .message-content {
    flex: 1;
    
    .message-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 15rpx;
      
      .sender-name {
        font-size: 32rpx;
        color: #333;
        font-weight: 500;
      }
      
      .message-time {
        font-size: 24rpx;
        color: #999;
      }
      
      .unread-count {
        background: #ff4757;
        color: white;
        border-radius: 50rpx;
        font-size: 20rpx;
        min-width: 36rpx;
        height: 36rpx;
        line-height: 36rpx;
        text-align: center;
        font-weight: bold;
      }
    }
    
    .message-preview {
      .message-text {
        font-size: 28rpx;
        color: #666;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
      }
      
      .sender-type {
        background: #e8f5e8;
        color: #5cb85c;
        font-size: 22rpx;
        padding: 4rpx 10rpx;
        border-radius: 10rpx;
        margin-left: 10rpx;
      }
    }
  }
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100rpx 60rpx;
  text-align: center;
  
  .empty-icon {
    width: 200rpx;
    height: 200rpx;
    margin-bottom: 30rpx;
    opacity: 0.3;
  }
  
  .empty-text {
    font-size: 30rpx;
    color: #999;
  }
}

/* 加载更多 */
.load-more {
  text-align: center;
  padding: 40rpx;
  
  text {
    font-size: 28rpx;
    color: #5cb85c;
    padding: 20rpx;
  }
}

/* 聊天弹窗 */
.chat-modal {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  
  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25rpx 30rpx;
    border-bottom: 1rpx solid #f0f0f0;
    background: #fafafa;
    
    .chat-header-info {
      display: flex;
      align-items: center;
      flex: 1;
      
      .chat-avatar {
        width: 80rpx;
        height: 80rpx;
        border-radius: 50%;
        margin-right: 20rpx;
      }
      
      .chat-user-info {
        .chat-user-name {
          display: block;
          font-size: 30rpx;
          color: #333;
          font-weight: 500;
          margin-bottom: 8rpx;
        }
        
        .chat-user-phone {
          display: block;
          font-size: 24rpx;
          color: #666;
          margin-bottom: 5rpx;
        }
        
        .online-status {
          font-size: 22rpx;
          padding: 4rpx 10rpx;
          border-radius: 10rpx;
          
          &.online {
            background: #e8f5e8;
            color: #5cb85c;
          }
          
          &.offline {
            background: #f5f5f5;
            color: #999;
          }
        }
      }
    }
    
    .modal-close {
      font-size: 48rpx;
      color: #999;
      line-height: 1;
      padding: 10rpx;
    }
  }
  
  .chat-messages {
    flex: 1;
    height: 400rpx;
    padding: 20rpx;
    background: #f8f9fa;
    
    .message-bubble {
      margin-bottom: 25rpx;
      
      .message-info {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10rpx;
        
        .sender-name {
          font-size: 24rpx;
          color: #666;
        }
        
        .message-time {
          font-size: 22rpx;
          color: #999;
        }
      }
      
      .message-content {
        .message-text {
          padding: 20rpx 25rpx;
          border-radius: 16rpx;
          font-size: 28rpx;
          line-height: 1.4;
        }
      }
      
      // 用户消息
      &.user-message {
        .message-content .message-text {
          background: white;
          color: #333;
          border: 1rpx solid #e0e0e0;
        }
      }
      
      // 商家消息
      &.merchant-message {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        
        .message-content .message-text {
          background: #5cb85c;
          color: white;
          max-width: 80%;
        }
        
        .message-info {
          margin-top: 10rpx;
          margin-bottom: 0;
        }
      }
      
      // 系统消息
      &.system-message {
        text-align: center;
        
        .coupon-message {
          .coupon-card {
            background: linear-gradient(135deg, #ff6b35, #ff8c42);
            color: white;
            padding: 25rpx;
            border-radius: 16rpx;
            text-align: center;
            display: inline-block;
            
            .coupon-title {
              display: block;
              font-size: 32rpx;
              font-weight: bold;
              margin-bottom: 10rpx;
            }
            
            .coupon-amount {
              display: block;
              font-size: 48rpx;
              font-weight: bold;
              margin-bottom: 10rpx;
            }
            
            .coupon-condition {
              display: block;
              font-size: 24rpx;
              opacity: 0.9;
              margin-bottom: 8rpx;
            }
            
            .coupon-expire {
              font-size: 22rpx;
              opacity: 0.8;
            }
          }
        }
        
        .group-invite-message {
          .invite-card {
            background: #e3f2fd;
            color: #1976d2;
            padding: 25rpx;
            border-radius: 16rpx;
            border: 2rpx solid #bbdefb;
            
            .invite-title {
              display: block;
              font-size: 28rpx;
              font-weight: 500;
              margin-bottom: 10rpx;
            }
            
            .member-count {
              font-size: 24rpx;
              opacity: 0.8;
            }
          }
        }
      }
    }
  }
  
  // 快捷回复
  .quick-replies {
    padding: 20rpx;
    border-top: 1rpx solid #f0f0f0;
    background: white;
    
    .quick-label {
      font-size: 24rpx;
      color: #666;
      margin-bottom: 15rpx;
    }
    
    .quick-scroll {
      white-space: nowrap;
      
      .quick-btn {
        display: inline-block;
        padding: 12rpx 20rpx;
        margin-right: 15rpx;
        background: #f8f9fa;
        border: 1rpx solid #e9ecef;
        border-radius: 20rpx;
        font-size: 24rpx;
        color: #666;
      }
    }
  }
  
  // 输入区域
  .chat-input-area {
    display: flex;
    align-items: center;
    padding: 20rpx;
    background: white;
    border-top: 1rpx solid #f0f0f0;
    gap: 15rpx;
    
    .message-input {
      flex: 1;
      padding: 20rpx;
      border: 1rpx solid #e0e0e0;
      border-radius: 25rpx;
      font-size: 28rpx;
      background: #fafafa;
      
      &:focus {
        border-color: #5cb85c;
        background: white;
      }
    }
    
    .input-actions {
      display: flex;
      gap: 10rpx;
      
      .send-coupon-btn {
        padding: 18rpx 25rpx;
        background: #ff6b35;
        color: white;
        border-radius: 20rpx;
        font-size: 24rpx;
        border: none;
        
        &::after {
          border: none;
        }
      }
      
      .send-message-btn {
        padding: 18rpx 30rpx;
        background: #5cb85c;
        color: white;
        border-radius: 20rpx;
        font-size: 26rpx;
        border: none;
        
        &:disabled {
          background: #ccc;
        }
        
        &::after {
          border: none;
        }
      }
    }
  }
}

/* 优惠券弹窗 */
.coupon-modal {
  .modal-body {
    .coupon-list {
      margin-bottom: 30rpx;
      
      .coupon-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 25rpx;
        background: #f8f9fa;
        border-radius: 12rpx;
        margin-bottom: 15rpx;
        border: 2rpx solid transparent;
        
        &:active {
          border-color: #5cb85c;
          background: #e8f5e8;
        }
        
        .coupon-info {
          flex: 1;
          
          .coupon-name {
            display: block;
            font-size: 30rpx;
            color: #333;
            font-weight: 500;
            margin-bottom: 8rpx;
          }
          
          .coupon-desc {
            display: block;
            font-size: 24rpx;
            color: #666;
            margin-bottom: 5rpx;
          }
          
          .coupon-validity {
            font-size: 22rpx;
            color: #999;
          }
        }
        
        .coupon-value {
          .coupon-amount {
            font-size: 36rpx;
            color: #ff6b35;
            font-weight: bold;
          }
        }
      }
    }
    
    .custom-message-input {
      .input-label {
        display: block;
        font-size: 28rpx;
        color: #333;
        font-weight: 500;
        margin-bottom: 15rpx;
      }
      
      .custom-input {
        width: 100%;
        padding: 20rpx;
        border: 2rpx solid #e0e0e0;
        border-radius: 12rpx;
        font-size: 28rpx;
        background: #fafafa;
        
        &:focus {
          border-color: #5cb85c;
          background: white;
        }
      }
    }
  }
}

/* 弹窗基础样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40rpx;
}

.modal-content {
  background: white;
  border-radius: 20rpx;
  width: 100%;
  max-width: 700rpx;
  max-height: 85vh;
  overflow: hidden;
  
  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30rpx;
    border-bottom: 1rpx solid #f0f0f0;
    
    .modal-title {
      font-size: 32rpx;
      font-weight: bold;
      color: #333;
    }
    
    .modal-close {
      font-size: 48rpx;
      color: #999;
      line-height: 1;
      padding: 10rpx;
    }
  }
  
  .modal-body {
    padding: 30rpx;
    max-height: 60vh;
    overflow-y: auto;
  }
  
  .modal-footer {
    display: flex;
    gap: 20rpx;
    padding: 30rpx;
    border-top: 1rpx solid #f0f0f0;
    
    .cancel-btn {
      flex: 1;
      padding: 25rpx;
      background: #f5f5f5;
      color: #666;
      border-radius: 12rpx;
      font-size: 30rpx;
      border: none;
      
      &::after {
        border: none;
      }
    }
    
    .confirm-btn {
      flex: 1;
      padding: 25rpx;
      background: #5cb85c;
      color: white;
      border-radius: 12rpx;
      font-size: 30rpx;
      border: none;
      
      &::after {
        border: none;
      }
      
      &:disabled {
        background: #ccc;
      }
    }
  }
}